package GUI;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JTextField;
import javax.swing.JButton;
import javax.swing.JLabel;
import java.awt.Font;
import java.util.ArrayList;
import java.util.List;

import javax.swing.BoxLayout;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;

import entity.Produto;

import persistence.ProdutoDAO;

public class AlterarGUI extends JFrame {

	private JPanel contentPane;
	private JTextField textField;
	private JTable table;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					AlterarGUI frame = new AlterarGUI();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public AlterarGUI() {
		setTitle("Alterar Produto");
		setBounds(100, 100, 800, 602);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.X_AXIS));
		
		JPanel panel = new JPanel();
		contentPane.add(panel);
		panel.setLayout(null);
		
		textField = new JTextField();
		textField.setColumns(10);
		textField.setBounds(165, 44, 331, 20);
		panel.add(textField);
		
		JButton button = new JButton("Buscar");
		button.setBounds(516, 43, 106, 23);
		panel.add(button);
		
		JLabel label = new JLabel("Pesquisar Produto");
		label.setFont(new Font("Tahoma", Font.BOLD, 14));
		label.setBounds(10, 43, 127, 14);
		panel.add(label);
		
		JScrollPane scrollPane = new JScrollPane();
		scrollPane.setBounds(36, 123, 724, 158);
		panel.add(scrollPane);
		ProdutoDAO dao = new ProdutoDAO();
		table = new JTable();
		table.setModel(new ModeloDeTabela(dao.listarProduto()));
		scrollPane.setViewportView(table);
	}

}
